package com.business.business.web.web;

import cn.hutool.json.JSONObject;
import com.business.business.common.base.BaseController;
import com.business.business.support.annotaion.Action;
import com.business.business.support.model.RespEntity;
import com.business.business.web.service.EmgTeamService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;

/**
 * @Author xulumin
 * @Date 2024/3/20 15:38
 * @Version 1.0
 * @Desc 应急团队控制器
 */
@Controller
@Action
@RequestMapping(value = "emergencyTeam")
public class EmgTeamController extends BaseController {

    @Resource
    private EmgTeamService emgTeamService;

    /**
     * Author: xulumin
     * Date: 2024/3/19
     * Description: 应急团队新增或者更新
     */
    @PostMapping("addOrUpdateTeam")
    public RespEntity addOrUpdateTeam(@RequestBody(required = false) JSONObject jsonObject) throws IllegalAccessException, InstantiationException {
        return emgTeamService.addOrUpdateTeam(jsonObject);
    }

    /**
     * Author: xulumin
     * Date: 2024/3/19
     * Description: 应急团队信息列表
     */
    @GetMapping("getTeamList")
    public RespEntity getTeamList(@RequestBody(required = false) JSONObject jsonObject) {
        return emgTeamService.getTeamList(jsonObject);
    }

    /**
     * Author: xulumin
     * Date: 2024/3/20
     * Description: 获取应急团队
     */
    @GetMapping("getTeamInfo")
    public RespEntity getTeamInfo(@RequestBody(required = false) JSONObject jsonObject) {
        return emgTeamService.getTeamInfo(jsonObject);
    }

    /**
     * Author: xulumin
     * Date: 2024/3/19
     * Description: 删除应急团队
     */
    @PostMapping("delTeam")
    public RespEntity delTeam(@RequestBody(required = false) JSONObject jsonObject) {
        return emgTeamService.delTeam(jsonObject);
    }
}
